package com.companyName.sample.core.task;

import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * Created by guo.jun on 2016/3/30.
 */
public class UserAsync {

    @Async
    public void testAsyncMethod(){
        try {
            //业务逻辑实现
            //让程序暂停100秒，相当于执行一个很耗时的任务
            Thread.sleep(10000);
            System.out.println("Async已经执行了！");
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        new UserAsync().testAsyncMethod();
        System.out.println("我已经执行了！");
    }
}
